import numpy as np
import matplotlib.pyplot as plt

# read the data from problemD.txt
data1 = np.loadtxt('./data/problemD_d.txt')
point1 = data1[:, 0]
value1 = data1[:, 1]
data2 = np.loadtxt('./data/problemD_v.txt')
point2 = data2[:, 0]
value2 = data2[:, 1]

# plot the data into curves
plt.plot(point1, value1, label="position")
plt.plot(point2, value2, label="speed")

plt.title("Car Problem")
plt.legend()
plt.savefig("./pic/problemD.png")
plt.show()
